package com.sdhs.projectschedule.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.core.page.TableDataInfo;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.projectschedule.domain.GcProgressMasterPlanMark;
import com.sdhs.projectschedule.service.IGcProgressMasterPlanMarkService;

/**
 * 项目进度控制--总体计划管理子--总体计划制定Controller
 *
 * @author ww
 * @date 2025-03-22
 */
@RestController
@RequestMapping("/progress/masterPlanMark")
public class GcProgressMasterPlanMarkController extends BaseController {
    @Autowired
    private IGcProgressMasterPlanMarkService gcProgressMasterPlanMarkService;

    /**
     * 查询项目进度控制--总体计划管理子--总体计划制定列表
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanMark:list')")
    @GetMapping("/list")
    public TableDataInfo list(String planId) {
        startPage();
        List<GcProgressMasterPlanMark> list = gcProgressMasterPlanMarkService.selectGcProgressMasterPlanMarkList(planId);
        return getDataTable(list);
    }

    /**
     * 修改项目进度控制--总体计划管理子--总体计划制定
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanMark:edit')")
    @Log(title = "项目进度控制--总体计划管理子--总体计划制定", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GcProgressMasterPlanMark gcProgressMasterPlanMark) {
        return toAjax(gcProgressMasterPlanMarkService.updateGcProgressMasterPlanMarkList(gcProgressMasterPlanMark));
    }

    /**
     * 逻辑删除项目进度控制--总体计划管理子--总体计划制定
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanMark:remove')")
    @Log(title = "项目进度控制--总体计划管理子--总体计划制定", businessType = BusinessType.DELETE)
    @DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(gcProgressMasterPlanMarkService.deleteGcProgressMasterPlanMarkById(id));
    }
}
